package com.jianzh5.action;

import com.alibaba.fastjson.JSON;
import org.apache.log4j.Logger;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by jianzh5 on 2015/7/9.
 */
public class BaseAction {

    protected final Logger logger = Logger.getLogger(BaseAction.class);

    protected void printOUT(HttpServletResponse response,String result){
        try {
            PrintWriter writer = response.getWriter();
            writer.write(result);
            writer.flush();
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    protected String getJson(Object object){
        String str = JSON.toJSONStringWithDateFormat(object, "yyyy-MM-dd HH:mm:ss");
        return str;
    }

}
